package com.ljh.mybatisplusdemo.config;

import com.ljh.mybatisplusdemo.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: Themberfue
 * @date: 2025/3/20 18:48
 * @description:
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // ? 将所有接口添加响应拦截器
                .excludePathPatterns("/user/login"); // ? 排除 login 接口
    }
}
